// /////////////////////////////////////////////////////////////////////////////
//
// Name:            asAssetProcessor.cpp
// Author:          Michael Bartsch (ZCCdark203)
//
// Desc :           Binds the AssetProcessor class to AngelScript
//
// License:         Copyright (C) 2009 Michael Bartsch and Contributors
//
//                  This program is free software: you can redistribute it
//                  and/or modify it under the terms of the zlib/libpng License.
//                  See main.cpp for conditions of distribution and use.
//
// /////////////////////////////////////////////////////////////////////////////

// Include files
#include "asAssetProcessor.h"

#ifdef __COMPILE_WITH_ANGELSCRIPT__

#include "../ScriptHelper.h"

#include "../../core/AssetProcessor.h"


//! Reference factory for the AssetProcessor class.
AssetProcessor* createAssetProcessor(AssetGroup *parent, const std::string &baseName)
{
    return new AssetProcessor(parent, baseName);
}

//! Binds the AssetProcessor class to AngelScript.
void bindAssetProcessor(asIScriptEngine *engine)
{
    // Forward declarations.
    int r;

    // Bind AssetProcessor class (and dependencies).
    r = engine->RegisterObjectType("AssetProcessor", sizeof(AssetProcessor), asOBJ_REF);
    r = engine->RegisterObjectType("AssetGroup", sizeof(AssetGroup), asOBJ_REF);

    // Get AssetProcessor base functions.
    bindAssetProcessorBase<AssetProcessor>(engine, "AssetProcessor");

    // Set AssetProcessor behaviour.
    r = engine->RegisterObjectBehaviour("AssetProcessor", asBEHAVE_FACTORY, "AssetProcessor@ f(AssetGroup @+, " \
                                        "const string &in)", asFUNCTION(createAssetProcessor), asCALL_CDECL);
                                        assert(r >= 0);

    r = engine->RegisterObjectMethod("AssetProcessor", "AssetProcessor& opAssign(const AssetProcessor &in)",
                                     asFUNCTION(assignT<AssetProcessor>), asCALL_CDECL_OBJFIRST); assert(r >= 0);
}

#endif // __COMPILE_WITH_ANGELSCRIPT__

// End of File
